/**
 * Copyright (c) 2014- 2015 YCY Group Holding Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 */
package com.jkwzms.common.repository.callback;

import javax.persistence.Query;

import com.jkwzms.common.entity.search.Searchable;

/**
 * <p>
 * User: Jack Liang
 * <p>
 * Date: 13-1-16 下午4:01
 * <p>
 * Version:1.0.0
 */
public interface SearchCallback {

    public static final SearchCallback NONE    = new NoneSearchCallback();
    public static final SearchCallback DEFAULT = new DefaultSearchCallback();

    /**
     * 动态拼HQL where、group by having
     * 
     * @param ql
     * @param search
     */
    public void prepareQL(StringBuilder ql, Searchable search);

    public void prepareOrder(StringBuilder ql, Searchable search);

    /**
     * 根据search给query赋值及设置分页信息
     * 
     * @param query
     * @param search
     */
    public void setValues(Query query, Searchable search);

    public void setPageable(Query query, Searchable search);

}
